package com.dudu.exception;

import lombok.Data;

/**
 * Created by dudu on 16/9/2.
 */
@Data
public class BusinessException extends RuntimeException {

    private ErrorCode errorCode;

    public BusinessException(ErrorCode errorCode) {
        super(errorCode.getMessage());
        this.errorCode = errorCode;
    }

    public BusinessException(ErrorCode errorCode, String errorMsg) {
        super(errorMsg);
        this.errorCode = errorCode;
        this.errorCode.setMessage(errorMsg);
    }
}
